using Mono.GetOptions;
using Sandia.MVCFramework.View;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sandia.MVCFramework.Common
{
    /// <summary>
    /// Command line options for AMR Exploration Tool
    /// </summary>
    public class StandardAppOptions : Options
    {
        /// <summary>
        /// Default directory in which to find plugins to load
        /// </summary>
        public static readonly string PLUGIN_DIRECTORY = "Plugins";

        /// <summary>
        /// File extension for plugin files
        /// </summary>
        public static readonly string PLUGIN_EXTENSION = "*.dll";

        /// <summary>
        /// Logging view (null if disabled)
        /// </summary>
        [Option("Enable logging view", "enableLoggingView")]
        public bool EnableLoggingView
        {
            get
            {
                return StandardAppOptions.enableLoggingView;
            }
            set
            {
                StandardAppOptions.enableLoggingView = value;
            }
        }        
        private static bool enableLoggingView = false;

        /// <summary>
        /// Provides static access to loggingView option
        /// </summary>
        /// <returns>Logging view (null if disabled)</returns>
        public static LoggingView GetALoggingView()
        {
            if (StandardAppOptions.enableLoggingView)
            {
                LoggingView loggingView = new LoggingView();
                StandardAppOptions.loggingViews.Add(loggingView);
                return loggingView;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// Returns the list of logging views
        /// </summary>
        /// <returns>List of logging views</returns>
        public static List<LoggingView> GetLoggingViews()
        {
            if (StandardAppOptions.enableLoggingView)
            {
                return loggingViews;
            }
            else
            {
                return null;
            }
        }
        private static List<LoggingView> loggingViews = new List<LoggingView>();
    }
}
